#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,a[101],ave=0,ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        ave+=a[i];
    }
    ave/=n;
    for (int i=1;i<=n;i++) {
        a[i]-=ave;
    }
    for (int i=1;i<=n;i++) {
        if(a[i]!=0) {
            a[i+1]+=a[i];
            ans++;
        }
    }
    printf("%d",ans);
    system("pause");
    return 0;
}